<template>
  <div>
    <div class="top">
      <div class="portrait">
        <img
          src="../../assets/deulte.png"
          width="64"
          height="64"
          alt=""
          srcset=""
        />
      </div>
      <div>
        <h4>{{ userinfo.username }}</h4>
        <p>{{ userinfo.phone }}</p>
      </div>
    </div>
    <div class="options">
      <div class="option" @click="goOrder">
        <div class="leftOpt">
          <img
            src="../../assets/order.png"
            width="25"
            height="25"
            alt=""
            srcset=""
          />
          我的订单
        </div>
        <div class="right">></div>
      </div>
      <div class="option" @click="toStoreup">
        <div class="leftOpt">
          <img
            src="../../assets/shou.png"
            width="25"
            height="25"
            alt=""
            srcset=""
          />
          我的收藏
        </div>
        <div class="right">></div>
      </div>
      <div class="option" @click="toSetting">
        <div class="leftOpt">
          <img
            src="../../assets/setting.png"
            width="25"
            height="25"
            alt=""
            srcset=""
          />
          设置
        </div>
        <div class="right">></div>
      </div>
    </div>
  </div>
</template>

<script>
export default {
  data() {
    return {
      userinfo: {},
    };
  },
  created() {
    this.getUserinfo();
  },
  methods: {
    async getUserinfo() {
      const { data: res } = await this.$http.get("user");
      if (res.status !== 200) return this.$message.fail("获取失败");
      this.userinfo = res.data;
    },
    goOrder(){
      this.$router.push('/order')
    },
    toStoreup(){
      this.$router.push('/storeup')
    },
    toSetting(){
      this.$router.push('/setting')
    }
  },
};
</script>

<style lang="less" scoped>
.top {
  background-color: #f6c90a;
  display: flex;
  flex-direction: row;
  padding-left: 20px;
  align-items: center;

  height: 150px;
  > .portrait {
    display: flex;
    margin-right: 20px;
  }
}
.option {
  display: flex;
  align-items: center;
  font-size: 16px;
  height: 60px;
  line-height: 60px;
  font-weight: 500;
  justify-content: space-between;
  border-bottom: 1px solid #ccc;
  > .leftOpt {
    margin-left: 20px;
    display: flex;
    align-items: center;
    >img{
      margin-right: 10px;
    }
  }
  .right {
    margin-right: 20px;
    font-size: 20px;
  }
}
</style>